# encoding: utf-8
# @File  : 03元素常用信息操作方法.py
# @Author: Morpheus
# @Date  : 2025/10/31/18:14



import time
# 模拟人操作浏览器
from selenium import webdriver
from selenium.webdriver.common.by import By

# 打开浏览器
driver = webdriver.Chrome()  # 创建浏览器对象
# 2.输入访问地址（URL）
driver.get("http://121.43.169.97:8848/pageA.html")
# 放大浏览器页面
driver.maximize_window()

# 1).通过脚本执行输入用户名：admin；密码：123456；电话号码：18611111111；电子邮件：123@qq.com
driver.find_element(By.ID,"userA").send_keys("admin")
driver.find_element(By.CSS_SELECTOR,"[name='passwordA']").send_keys("123456")
driver.find_element(By.CSS_SELECTOR,".telA").send_keys("18611111111")
driver.find_element(By.XPATH,"//p[4]/input").send_keys("123@qq.com")

# 2).间隔3秒，修改电话号码为：18600000000
time.sleep(3)
driver.find_element(By.CSS_SELECTOR,".telA").clear()
# driver.find_element(By.CSS_SELECTOR,".telA").send_keys("18600000000")
driver.find_element_by_css_selector(".telA").send_keys("18600000000")

# 3).间隔3秒，点击‘注册’按钮
time.sleep(3)
driver.find_element_by_css_selector("button").click()

# 4).间隔3秒，关闭浏览器
time.sleep(3)
driver.quit()
